function getRandomInt(mix, max) {
  return Math.floor(Math.random() * (max - mix + 1) + mix)
}

export function shuffle(arr) {

  let _arr = arr.slice()
  _arr.forEach((item, i) => {
    const j = getRandomInt(0, i)
    let t = _arr[i]
    _arr[i] = _arr[j]
    _arr[j] = t
  })
  return _arr
}

export function debounce(func, delay) {
  let timer = null

  return function (...arg) {
    if (timer) {
      clearTimeout(timer)
    }
    timer = setTimeout(() => {
      func.apply(this, arg)
    }, 200)
  }
}
